﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data.DataGet;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Business.DataBusiness
{
    public class HoaDonNhap
    {
        _HoaDonNhap data = new _HoaDonNhap();
        
        private string maHDN;
        private string donViCungCap;
        private string diaChi;
        private string maNV;
        private float thueNhap;
        private float tongTien;
        private float khuyenMai;
        private DateTime ngayNhap;


        public string MaHDN
        {
            get { return maHDN; }
            set { maHDN = value; }
        }
       

        public string DonViCungCap
        {
            get { return donViCungCap; }
            set { donViCungCap = value; }
        }
       
        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }
       
        public string MaNV
        {
            get { return maNV; }
            set 
            {
                maNV = value;
                if (maNV == "")
                    throw new Exception("Mã nhân viên nhập hàng ?");
            }
        }
       
        public float ThueNhap
        {
            get { return thueNhap; }
            set { thueNhap = value; }
        }
       
        public float TongTien
        {
            get { return tongTien; }
            set 
            { 
                tongTien = value;
                if (tongTien < 0)
                    throw new Exception("Tổng tiền phải lớn hơn 0");
            }
        }
        
        public float KhuyenMai
        {
            get { return khuyenMai; }
            set { khuyenMai = value; }
        }
       
        public DateTime NgayNhap
        {
            get { return ngayNhap; }
            set { ngayNhap = value; }
        }
       
        public HoaDonNhap() { }
        public HoaDonNhap(string maHDN1, string donViCungCap1, string diaChi1, string maNV1, float thueNhap1, float tongTien1, float khuyenMai1, DateTime ngayNhap1)
        {
            this.MaHDN = maHDN1;
            this.DonViCungCap = donViCungCap1;
            this.DiaChi = diaChi1;
            this.MaNV = maNV1;
            this.ThueNhap = thueNhap1;
            this.TongTien = tongTien1;
            this.KhuyenMai = khuyenMai1;
            this.NgayNhap = ngayNhap1;
        }
        public int Insert()
        {
            return data.Insert_HoaDonNhap(this.MaHDN,this.DonViCungCap,this.DiaChi,this.MaNV,this.ThueNhap,this.TongTien,this.KhuyenMai,this.NgayNhap);
        }
    }
}
